import authority
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.defaults import url, include, patterns
from django.contrib import admin



admin.autodiscover()
authority.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^authority/', include('authority.urls')),
    (r'^i18n/', include('django.conf.urls.i18n')),
    (r'^admin/', include(admin.site.urls)),
   
    
    (r'^blog/$', 'blog.views.postindex'),
    (r'^blog/(?P<slug>[-\w]+)$', 'blog.views.postsingle'),
    
    url(r'^products/$', 'product.views.producthome', name='producthome'),
    url(r'^products/(?P<slug>[-\w]+)$', 'product.views.productsingle', name='products'),
   
    
    (r'^contact/', 'contact.views.contact'),
)

if settings.DEBUG:
    urlpatterns += patterns('',
        # Trick for Django to support static files (security hole: only for Dev environement! remove this on Prod!!!)
        url(r'^admin/pages/page(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.PAGES_MEDIA_ROOT}),
        url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
        url(r'^admin_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.ADMIN_MEDIA_ROOT}),
    )

urlpatterns += patterns('',      
    (r'^', include('pages.urls')),
    )
